﻿using System.Collections.Generic;
using System.Threading.Tasks;
using NiuX.Utils.Excel.Abstractions;
using NiuX.Utils.Excel.Utils;

namespace NiuX.Utils.Excel.Extensions;

public static class EpplusExtensions
{
    public static Task<byte[]> GetBytesAsync<T>(this List<T> data, string sheetName = "sheet") => EpplusUtility.GetBytesAsync(data, sheetName);

    public static byte[] GetBytes<T>(this List<T> data, string sheetName = "sheet") => EpplusUtility.GetBytes(data, sheetName);

    public static Task<byte[]> GetBytesAsync<T>(this IEPPlusOperation<T> operation, string sheetName = "sheet") => EpplusUtility.GetBytesAsync(operation.Data, sheetName);

    public static byte[] GetBytes<T>(this IEPPlusOperation<T> operation, string sheetName = "sheet") => EpplusUtility.GetBytes(operation.Data, sheetName);
}

